package com.dkm.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.dkm.entity.Counselor;

public interface CounselorRepository extends JpaRepository<Counselor, String>,JpaSpecificationExecutor<Counselor> {

	/**
	 * 根据用户id和角色名获取咨询师
	 * @param user_id
	 * @return
	 */
	@Query(value = "from Counselor where user_id=:user_id and roleName='咨询师'")
	Counselor getCounselorByUser_id(@Param("user_id")String user_id);
	/**
	 * 根据用户id和角色名获取网络咨询师
	 * @param user_id
	 * @return
	 */
	@Query(value = "from Counselor where user_id=:user_id and roleName='网络咨询师'")
	Counselor getNetCounselorByUser_id(@Param("user_id")String user_id);
}
